package a2_p04_ak_fh_test;

import static org.junit.Assert.*;

import java.util.ArrayList;
import java.util.List;

import org.jgrapht.graph.DefaultWeightedEdge;
import org.jgrapht.Graph;
import org.jgrapht.WeightedGraph;
import org.junit.Assert;
import org.junit.Test;

import a2_p04_ak_fh.IOHelper;
import a2_p04_ak_fh.Astern;
import a2_p04_ak_fh.AttVertex;

public class AsternTest {

	List<AttVertex> g1 = new ArrayList<AttVertex>();
	List<AttVertex> g2  = new ArrayList<AttVertex>();
	List<AttVertex> g3 = new ArrayList<AttVertex>();

	@Test
	public void testGraph3Husum() {

		System.out.println("Test Husum->Hamburg");
		
		g1.add(new AttVertex("Husum", 120.0));
		g1.add(new AttVertex("Kiel", 86.0));
		g1.add(new AttVertex("Uelzen", 94.0));
		g1.add(new AttVertex("Rotenburg", 63.0));
		g1.add(new AttVertex("Soltau", 63.0));
		g1.add(new AttVertex("Lueneburg", 20.0));
		g1.add(new AttVertex("Hamburg", 0.0));
		

		IOHelper IOHelper = new IOHelper();

		WeightedGraph<AttVertex, DefaultWeightedEdge> graph = IOHelper
				.readGraphFile("graph3.gka");

		assertEquals(g1, Astern.CalcA(graph, "Husum", "Hamburg"));
	}
	
	@Test
	public void testGraph3Minden() {

		System.out.println("Test Minden->Hamburg");
		
		g2.add(new AttVertex("Minden", 157.0));
		g2.add(new AttVertex("Walsrode", 20.0));
		g2.add(new AttVertex("Hamburg", 0.0));
		

		IOHelper IOHelper = new IOHelper();

		WeightedGraph<AttVertex, DefaultWeightedEdge> graph = IOHelper
				.readGraphFile("graph3.gka");

		assertEquals(g2, Astern.CalcA(graph, "Minden", "Hamburg"));
	}
	
	
	@Test
	public void testGraph3Muenster() {

		System.out.println("Test Muenster->Hamburg");
		
		g3.add(new AttVertex("Muenster", 237.0));
		g3.add(new AttVertex("Bremen", 44.0));
		g3.add(new AttVertex("Hamburg", 0.0));
		

		IOHelper IOHelper = new IOHelper();

		WeightedGraph<AttVertex, DefaultWeightedEdge> graph = IOHelper
				.readGraphFile("graph3.gka");

		assertEquals(g3, Astern.CalcA(graph, "Muenster", "Hamburg"));
	}
	

}
